package ch.zbw.timeline.domain;

import java.io.Serializable;
import java.sql.Time;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import lombok.Data;

/**
 * Domain class for a daily presence
 */
@Entity
@SequenceGenerator(name = "id_daily_presence", initialValue = 1, allocationSize = 1)
@Table(name = "daily_presence")
@Data
public class DailyPresence implements Serializable {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id_daily_presence", nullable = false)
	private int id;

	@Column(name = "fk_employee", nullable = false)
	private int employeeFk;

	@Column(name = "fk_year_config", nullable = false)
	private int yearFk;

	@Column(name = "month", nullable = true)
	private Integer month;

	@Column(name = "day", nullable = true)
	private Integer day;

	@Column(name = "morning_start", nullable = true)
	private Time morningStart;

	@Column(name = "morning_end", nullable = true)
	private Time morningEnd;

	@Column(name = "afternoon_start", nullable = true)
	private Time afternoonStart;

	@Column(name = "afternoon_end", nullable = true)
	private Time afternoonEnd;

	@Column(name = "morning_vacation", nullable = false)
	private int morningVacation;

	@Column(name = "afternoon_vacation", nullable = false)
	private int afternoonVacation;

	@Transient
	private int year;

	public DailyPresence() {
	}

	public DailyPresence(int employeeFk, int yearFk, Integer month,
			Integer day, Time morningStart, Time morningEnd,
			Time afternoonStart, Time afternoonEnd, int morningVacation,
			int afternoonVacation) {
		this.employeeFk = employeeFk;
		this.yearFk = yearFk;
		this.month = month;
		this.day = day;
		this.morningStart = morningStart;
		this.morningEnd = morningEnd;
		this.afternoonStart = afternoonStart;
		this.afternoonEnd = afternoonEnd;
		this.morningVacation = morningVacation;
		this.afternoonVacation = afternoonVacation;
	}

}